/* -----------------------------------------------------------------------------
 * PROJECT    : net.lwf
 * FILE       : TensesHandler.java
 *
 * HISTORY:
 * Date          Author                        Description
 * ----------------------------------------------------------------------------- 
 * Dec 15, 2008       Raghu Sarraff			       Created
 */
package lwf.handler.english;

import java.util.List;

import net.lwf.handler.util.ImageHtml;

import lwf.factory.PropertyReader;
import lwf.handler.entities.Tenses;

/**
 * Type the class description here
 *  
 */
public class TensesHandler extends WordHandler {
	
	private boolean headingdisplay = false;

	public TensesHandler(int start, int end) {
		init(start, end);
	}
	
	private void init(int start, int end) {
		List lstTenses = (List) PropertyReader.getInstance().getTenses();
		setDisplayData(start, end, lstTenses);
	}
  
  protected String processRowData(Object obj) {
  	Tenses tenses = (Tenses) obj;
  	StringBuffer sbPData = new StringBuffer();
  	sbPData.append("<table border=\"0\" width=\"100%\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\">");
  	    if(!headingdisplay) {
  		    sbPData.append("<tr>");
		        sbPData.append("<td width=\"10%\">&nbsp;</td>");
		        sbPData.append("<td width=\"25%\" class=\"tableHeader\" nowrap>Present</td>");		        
		        sbPData.append("<td width=\"25%\" class=\"tableHeader\" nowrap>Past</td>");
		        sbPData.append("<td width=\"25%\" class=\"tableHeader\" nowrap>Past Participle</td>");
		        sbPData.append("<td width=\"15%\"> &nbsp; </td>");
	        sbPData.append("</tr>");
	        headingdisplay = true;
  	    }
	    sbPData.append("<tr>");
	        sbPData.append("<td width=\"10%\">");
		        sbPData.append(ImageHtml.getBulletImage(1));
	        sbPData.append("</td>");
	        sbPData.append("<td width=\"25%\" class=\"dataleft\" >");
	        	sbPData.append(tenses.getPresent());
            sbPData.append("</td>");		        
	        sbPData.append("<td width=\"25%\" class=\"dataleft\" >");
        		sbPData.append(tenses.getPast());
        	sbPData.append("</td>");
        	sbPData.append("<td width=\"25%\" class=\"dataleft\" >");
        		sbPData.append(tenses.getPastParticiple());
            sbPData.append("</td>");
	        sbPData.append("<td width=\"15%\"> &nbsp; </td>");
	    sbPData.append("</tr>");                
      sbPData.append("</table>");
      return sbPData.toString();
  } //processRowData

} //TensesHandler

